package com.bcx.crm.spring_boot.springTaskAsync;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * Created by ys on 2018/4/8.
 */
@Service
public class AsyncTaskService {
    @Async  //表明该方法是个异步(如果标注在类上，则类下的所有方法都是异步)
            //该方法自动被注入使用ThreadPoolTaskExecutor 作为TaskExecutor
    public void executeAsyncTask(Integer i){
        System.out.println("执行异步任务 : "+i);
    }
    @Async
    public void executeAsyncTaskPlus(Integer i){
        System.out.println("执行异步任务+1 : "+i);
    }
}
